package com.cedric.yixianpai.game.cards.Sects.swordCards.b_ZhuJi;

import com.cedric.yixianpai.game.Constants.CardType;
import com.cedric.yixianpai.game.Constants.Period;
import com.cedric.yixianpai.game.Status.DuelStatus;
import com.cedric.yixianpai.game.interfaces.SwordCard;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

@Component
public class Kuang_1 extends SwordCard {
    int x;//每用过一次狂剑多x攻

    /**
     * 狂剑·一式
     * 5/8/10+2/3/5*n
     */
    public Kuang_1(@Value("1") int lvl) {
        super("狂剑·一式");
        this.setPeriod(Period.ZHUJI);
        this.setDescription("5/8/10攻，每用过一张狂剑多2/3/5攻");
        this.setCardType(CardType.KUANG);
        this.setLevel(lvl);
        if (1 == lvl) {
            this.setDamage(5);
            this.x = 2;
        } else if (2 == lvl) {
            this.setDamage(8);
            this.x = 3;
        } else if (3 == lvl) {
            this.setDamage(10);
            this.x = 5;
        } else {
            throw new RuntimeException("Card Level Error!");
        }
    }

    @Override
    public boolean effect(DuelStatus Sta1, DuelStatus Sta2) {
        int Kuang_damage = this.getDamage() + Sta1.getPlayerBuff().getKuang_Times() * this.x;
        int hurtValue = Sta1.attack(Sta2, Kuang_damage);
        Sta1.getPlayerBuff().clearSwordIntent();
        if (Sta1.getPlayerBuff().getKuang_Vampire() > 0) {
            int vampire = Sta1.getPlayerBuff().getKuang_Vampire();
            Sta1.heal(hurtValue * vampire / 100);
        }
        return true;
    }
}
